<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use \Illuminate\Support\Facades\Route;

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
Route::post("/file/imageupload", "FileController@imageupload")->name("imageupload");

Route::post('wechatserver', 'WechatServerController@serve');
Route::any('wechatserver', 'WechatServerController@serve');
Route::any("wechatserver/registerscene", 'WechatServerController@registerscene');

Route::group(['prefix' => 'config'],function (){
    Route::get("{module}", "ConfigController@config");
    Route::post("save", "ConfigController@save")->name("configsave");
});



Route::group(['prefix' => 'qrcode'],function (){
    Route::get("",'QrcodeController@index')->name("qrcode_index");
    Route::get("edit/{id?}",'QrcodeController@edit')->where('id', '[0-9]+');
    Route::post("save/{id?}",'QrcodeController@save')->where('id', '[0-9]+');
    Route::get("delete/{id}",'QrcodeController@delete')->where('id', '[0-9]+');
    Route::get("export",'QrcodeController@export')->name("qrcode_export");
    Route::get("fanslist/{scene_id}",['as' => 'qrcode.fanslist', 'uses' => 'QrcodeController@fanslist'])->where('scene_id', '[0-9]+');
});

Route::group(['prefix' => 'menu'],function (){
    Route::get("",'MenuController@index')->name("menu_index");
    Route::get("edit/{id?}",'MenuController@edit')->where('id', '[0-9]+');
    Route::post("save/{id?}",'MenuController@save')->where('id', '[0-9]+');
    Route::get("delete/{id}",'MenuController@delete')->where('id', '[0-9]+');

    Route::get("order/{id}/{act?}",'MenuController@order')->where('id', '[0-9]+');
    Route::get("sync",'MenuController@sync')->name("menu_sync");
    Route::get("getfromremote",'MenuController@getfromremote')->name("menu_getfromremote");
});

Route::group(['prefix' => 'staff'],function (){
    Route::get("",'StaffController@index')->name("staff_index");
    Route::get("edit/{id?}",'StaffController@edit')->where('id', '[0-9]+');
    Route::post("save/{id?}",'StaffController@save')->where('id', '[0-9]+');
    Route::get("delete/{id}",'StaffController@delete')->where('id', '[0-9]+');

    Route::get("sync",'StaffController@sync')->name("staff_sync");
});

Route::group(['prefix' => 'material'],function (){
    Route::get("",'MaterialController@index')->name("material_index");
    Route::get("edit/{id?}",'MaterialController@edit')->where('id', '[0-9]+');
    Route::post("save/{id?}",'MaterialController@save')->where('id', '[0-9]+');
    Route::get("delete/{id}",'MaterialController@delete')->where('id', '[0-9]+');
    Route::get("getremote",'MaterialController@getremote')->name("material_getremote");

    Route::get("sync",'StaffController@sync')->name("material_sync");
});



